﻿@model Apps.Models.PUB.PUB_MATERIELModel
@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Models.PUB;
@using Apps.Web;
@using Apps.Locale;
@using Apps.Models.Sys;
@{
    ViewBag.Title = "修改";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
}

<script type="text/javascript">
    $(function () {
    var tempid='@Html.Raw(Model.CTEMPLATE_ID)';
        $.ajax({
            url: "@Url.Action("GetTempList")",
            type: 'post',
            dataType: 'json',
            success: function (result) {
                $('#CTEMPLATE_ID').combobox({
                    data: result,
                    valueField: 'Value',
                    textField: 'Text',
                    onLoadSuccess: function () {
                        $("#CTEMPLATE_ID").combobox("setValue", tempid);
                    }
                });
            }
        });
    $("#btnSave").click(function () {
        if ($("form").valid()) {
            $.ajax({
                url: "@Url.Action("Edit")",
                type: "Post",
                data: $("form").serialize(),
                dataType: "json",
                success: function (data) {
                    if (data.type == 1) {
                        window.parent.frameReturnByMes(data.message);
                        window.parent.frameReturnByReload(false);
                        window.parent.frameReturnByClose()
                    }
                    else {
                        window.parent.frameReturnByMes(data.message);
                    }
                }
            });
        }
        return false;
    });
    $("#btnReturn").click(function () {
         window.parent.frameReturnByClose();
    });
});
</script>
<div class="mvctool bgb">
@Html.ToolButton("btnSave", "fa fa-save", Resource.Save,ref perm, "Save", true)
@Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply,false)
</div>
@using (Html.BeginForm())
{
    @Html.HiddenFor(model => model.MATERIEL_ID)
    @*@Html.HiddenFor(model => model.MATERIEL_TYPE_ID)*@
    @Html.HiddenFor(model => model.KKSCODE)
    <table class="formtable">
        <tbody>
            <tr>
                <th>
                    @Html.LabelFor(model => model.MATERIEL_NAME, 0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.MATERIEL_NAME)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.MATERIEL_TYPE_ID, 0)：
                </th>
                <td>
                    @Html.DropDownListFor(model => model.MATERIEL_TYPE_ID, ViewBag.MaterielType as SelectList)
                </td>
            </tr>
            <tr style="display:none">
                <th>
                    @Html.LabelFor(model => model.STATISTICS, 0)：
                </th>
                <td>
                    @Html.DropDownListFor(model => model.STATISTICS, ViewBag.MetStatisticsType as SelectList)
                </td>
            </tr>
            <tr style="display:none">
                <th>
                    @Html.LabelFor(model => model.TEMPLATE_ID, 0)：
                </th>
                <td>
                    @Html.DropDownListFor(model => model.TEMPLATE_ID, ViewBag.Template as SelectList)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.CTEMPLATE_ID, 0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.CTEMPLATE_ID)
                    @*@Html.DropDownListFor(model => model.CTEMPLATE_ID, ViewBag.CTemplate as SelectList, "")*@
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.REMARKS, 0)：
                </th>
                <td>
                    @Html.TextAreaFor(model => model.REMARKS, new { @style = "height:50px" })
                </td>
            </tr>
        </tbody>
    </table>
@Html.ValidationSummary()
}

